﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DDD.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class addBoxMessage : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<int>(
                name: "Sex",
                table: "User",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "性别",
                oldClrType: typeof(int),
                oldType: "int",
                oldDefaultValue: 3,
                oldComment: "性别");

            migrationBuilder.CreateTable(
                name: "BoxMessage",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "消息类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Content = table.Column<string>(type: "longtext", nullable: false, comment: "消息主体")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValue: new DateTime(2024, 1, 22, 10, 58, 54, 34, DateTimeKind.Local).AddTicks(4549), comment: "创建时间"),
                    RetryTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "重试次数"),
                    LastSendTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "上次发送时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BoxMessage", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_BoxMessage_CreateTime",
                table: "BoxMessage",
                column: "CreateTime");

            migrationBuilder.CreateIndex(
                name: "IX_BoxMessage_Name",
                table: "BoxMessage",
                column: "Name");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "BoxMessage");

            migrationBuilder.AlterColumn<int>(
                name: "Sex",
                table: "User",
                type: "int",
                nullable: false,
                defaultValue: 3,
                comment: "性别",
                oldClrType: typeof(int),
                oldType: "int",
                oldDefaultValue: 0,
                oldComment: "性别");
        }
    }
}
